package com.booza.dao;

import java.util.List;

import com.booza.model.CreditCardDetails;

/**
 * A DAO level interface for credit card details table.
 */
public interface CreditCardDetailsDAO
{
	/**
	 * Find a row by PK in credit card details table.
	 * 
	 * @param id
	 * @return An instance of CreditCardDetails
	 */
	CreditCardDetails findById(Integer id);

	/**
	 * Finds all the credit cards for a given account/user for a given card type. If type is null or blank then it gets
	 * all the cards for a given account/user.
	 * 
	 * @param accountId
	 *          - account id
	 * @param cardType
	 *          - Card Type like MS (Maestro SecureCode) or CC (Credit Card)
	 * @return A List of CreditCardDetails
	 */
	List<CreditCardDetails> findCCForUser(int accountId, String cardType);

	/**
	 * Finds if the credit card already exists for a given account/user and credit card number combination.
	 * 
	 * @param accountId
	 *          - account id
	 * @param creditCardNumber
	 *          - credit Card Number
	 * @param cardType
	 *          - Card Type like MS (Maestro SecureCode) or CC (Credit Card)
	 * @return An instance of CreditCardDetails
	 */
	CreditCardDetails findCCForUserWithCCNum(int accountId, String creditCardNumber, String cardType);

	/**
	 * Inserts or updates credit card details.
	 * 
	 * @param An
	 *          instance of CreditCardDetails to be saved.
	 */
	void saveCreditCardDetails(CreditCardDetails cc);

	/**
	 * Deletes the credit card details.
	 * 
	 * @param An
	 *          instance of CreditCardDetails to be deleted.
	 */
	void deleteCreditCard(Integer cardId);
}

